home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / kcl / kcl.lha / h / bds.h < prev    next >
C/C++ Source or Header  |  1987-06-04  |  863b  |  42 lines

  1. /*
  2. (c) Copyright Taiichi Yuasa and Masami Hagiya, 1984.  All rights reserved.
  3. Copying of this file is authorized to users who have executed the true and
  4. proper "License Agreement for Kyoto Common LISP" with SIGLISP.
  5. */
  6.  
  7. /*
  8.     bds.h
  9.  
  10.     bind stack
  11. */
  12.  
  13. #define BDSSIZE        1024
  14. #define    BDSGETA        16
  15.  
  16. struct bds_bd {
  17.     object    bds_sym;    /*  symbol  */
  18.     object    bds_val;    /*  previous value of the symbol  */
  19. };
  20.  
  21. struct bds_bd bind_stack[BDSSIZE + BDSGETA + BDSGETA];
  22.  
  23. #define bds_org        bind_stack
  24.  
  25. typedef struct bds_bd *bds_ptr;
  26.  
  27. bds_ptr bds_limit;
  28.  
  29. bds_ptr bds_top;        /*  bind stack top  */
  30.  
  31. #define    bds_check  \
  32.     if (bds_top >= bds_limit)  \
  33.         bds_overflow()
  34.  
  35. #define    bds_bind(sym, val)  \
  36.     (++bds_top)->bds_sym = (sym);  \
  37.     bds_top->bds_val = (sym)->s.s_dbind;  \
  38.     (sym)->s.s_dbind = (val)
  39.  
  40. #define    bds_unwind1  \
  41.     ((bds_top->bds_sym)->s.s_dbind = bds_top->bds_val, --bds_top)
  42.